package com.fanfanwang.ffw.app.adapter;

import java.util.ArrayList;

import com.fanfanwang.ffw.app.bean.ServiceBean;
import com.fanfanwang.ffw.app.tenant.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


public class ZhiHangListAdapter extends BaseAdapter {

	private ArrayList<ServiceBean> beans;
	private Context mContext;
	public ZhiHangListAdapter(Context mContext,ArrayList<ServiceBean> beans) {
		// TODO Auto-generated constructor stub
		this.mContext = mContext;
		this.beans = beans;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return beans.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		final ViewHolder holder;
		if (convertView == null) {
			LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView = inflater.inflate(R.layout.item_for_zhihanglist, null);
			holder = new ViewHolder();
			holder.service_title = (TextView) convertView.findViewById(R.id.service_title);
			holder.service_content = (TextView) convertView.findViewById(R.id.service_content);
			holder.service_title.setText(beans.get(position).serviceTitle);
			holder.service_content.setText(beans.get(position).serviceContent);
			convertView.setTag(holder);
		}else {
			holder = (ViewHolder) convertView.getTag();
		}
		return convertView;

	}

	class ViewHolder {
		TextView service_title;
		TextView service_content;
	}


}
